Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Hostname validator #298

Merged
merged 1 commit into from
Jul 3, 2024
Merged

Conversation

gsteel
Copy link
Member

@gsteel gsteel commented Jun 30, 2024

Q A
Documentation yes
BC Break yes
QA yes

Description

  • Only allow a well known array shape as options for the constructor
  • Add types everywhere
  • Replace internal options array with RO props
  • Remove option setters and getters

@@ -63,7 +62,7 @@ To check for IP addresses only, you can use the example below:
```php
use Laminas\Validator\Hostname;

$validator = new Hostname(Hostname::ALLOW_IP);
$validator = new Hostname(['allow' => Hostname::ALLOW_IP]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the single parameter approach still working?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, only an options array is accepted

- Only allow a well known array shape as options for the constructor
- Add types everywhere
- Replace internal options array with RO props
- Remove option setters and getters

Signed-off-by: George Steel <[email protected]>
@gsteel gsteel self-assigned this Jul 3, 2024
@gsteel gsteel merged commit 122a9f2 into laminas:3.0.x Jul 3, 2024
14 of 15 checks passed
@gsteel gsteel deleted the v3/refactor-hostname branch July 3, 2024 08:08
gsteel added a commit to gsteel/laminas-validator that referenced this pull request Jul 4, 2024
In laminas#298 the `$validTlds` property declaration was changed but the regex in the script was not.

This patch also removes the check for `ext-intl` which is already available in CI, and instead outputs an error when not available. This has the side effect of 100% type coverage

Signed-off-by: George Steel <[email protected]>
@gsteel gsteel mentioned this pull request Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants